ROS2 gazebo (classic) ultrasonic sensor
Table of Content
- Create simple model with ultrasonic sensor
- Spawn the model into gazebo world
- View sensor output in RVIZ
sdf / sensor#
ultrasonic/model.sdf
launch#
launch/ultrasonic.launch.py
tf#
- Add static tf between world to link (model)
link_tf = Node(
package='tf2_ros',
executable='static_transform_publisher',
name="link2world",
arguments = ["0", "0", "0.05", "0", "0", "0", "world", "link"]
)
Test sensor read#
ultrasonic_demo_.py
run#

run again#
out of range reading
When sensor reading is out of range:
- The visual marker turn brighter
- Rviz stop show marker
- BUG: subscriber stop read data from topic (for output_type sensor_msgs/Range)
echo topic
ros2 topic echo /ultrasonic_sensor_1
Unable to convert call argument to Python object (compile in debug mode for details)
